package com.zq.api.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import com.zq.common.annotation.Log;
import com.zq.common.core.controller.BaseController;
import com.zq.common.core.domain.AjaxResult;
import com.zq.common.core.page.TableDataInfo;
import com.zq.common.enums.BusinessType;
import com.zq.server.api.domain.entity.ApiTeamMember;
import com.zq.server.api.service.IApiTeamMemberService;

/**
 * 战队成员Controller
 * 
 * @author 财哥
 * @date 2024-03-31
 */
@RestController
@RequestMapping("/system/ApiTeamMember")
public class ApiTeamMemberController extends BaseController
{
    @Autowired
    private IApiTeamMemberService apiTeamMemberService;

    /**
     * 查询战队成员列表
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeamMember:list')")
    @GetMapping("/list")
    public TableDataInfo list(ApiTeamMember apiTeamMember)
    {
        startPage();
        List<ApiTeamMember> list = apiTeamMemberService.selectApiTeamMemberList(apiTeamMember);
        return getDataTable(list);
    }

//    /**
//     * 导出战队成员列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:ApiTeamMember:export')")
//    @Log(title = "战队成员", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, ApiTeamMember apiTeamMember)
//    {
//        List<ApiTeamMember> list = apiTeamMemberService.selectApiTeamMemberList(apiTeamMember);
//        ExcelUtil<ApiTeamMember> util = new ExcelUtil<ApiTeamMember>(ApiTeamMember.class);
//        util.exportExcel(response, list, "战队成员数据");
//    }

    /**
     * 获取战队成员详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeamMember:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(apiTeamMemberService.selectApiTeamMemberById(id));
    }

    /**
     * 新增战队成员
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeamMember:add')")
    @Log(title = "战队成员", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApiTeamMember apiTeamMember)
    {
        return toAjax(apiTeamMemberService.insertApiTeamMember(apiTeamMember));
    }

    /**
     * 修改战队成员
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeamMember:edit')")
    @Log(title = "战队成员", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApiTeamMember apiTeamMember)
    {
        return toAjax(apiTeamMemberService.updateApiTeamMember(apiTeamMember));
    }
    /**
     * 删除战队成员
     */
    @PreAuthorize("@ss.hasPermi('system:ApiTeamMember:remove')")
    @Log(title = "战队成员", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(apiTeamMemberService.deleteApiTeamMemberByIds(ids));
    }
}
